package com.cy.pj.goods.dao.implrmrnts;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class GoodsDaoImpl implements GoodsDao {
    @Autowired
    private SqlSession sqlSession;
    @Override
    public List<Goods> findGoods(){
        String namespace=sqlSession.getClass().getInterfaces()[0].getName();
//        String statement=namepacse+".findGoods";
        String elementId=Thread.currentThread().getStackTrace()[1].getMethodName();
        String statement=namespace+elementId;
        List<Goods> list = sqlSession.selectList(statement);
        return list;
    }

}
